package com.audaque.springboot.foshanupload.security.aspect;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
@Aspect
@Component
public class SecurityFilterTimingAspect {

    @Around("execution(* org.springframework.security.web.FilterChainProxy.doFilter(..))")
    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        Object result = joinPoint.proceed(); // 继续执行过滤链
        stopWatch.stop();
        System.out.println("Security Filter Chain Execution Time: " + stopWatch.getTotalTimeMillis() + " ms");
        return result;
    }
}